package com.xigua.chapter_1_iterator.example_1_1;

import com.sun.org.apache.bcel.internal.generic.NEW;
import com.xigua.chapter_1_iterator.example_1_1.book.Book;
import com.xigua.chapter_1_iterator.example_1_1.book.BookShelf;
import com.xigua.chapter_1_iterator.example_1_1.book.BookShelfIterator;
import com.xigua.chapter_1_iterator.example_1_1.book.Iterator;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/3/2617:04
 */
public class Main {
    public static void main(String[] args) {
        Book java = new Book("jvm虚拟机原理");
        Book python = new Book("ptyhon数据分析");
        Book go = new Book("Go从入门到入土");
        Book C = new Book("c指针");
        BookShelf bookShelf = new BookShelf(3);
        bookShelf.appendBook(java);
        bookShelf.appendBook(python);
        bookShelf.appendBook(go);
        bookShelf.appendBook(C);
        Iterator iterator = bookShelf.iterator();
        while (iterator.hasNext()){
            Book book = (Book) iterator.next();
            System.out.println(book.getName());
        }
    }
}
